//
//  BetsAndBrainsViewController.m
//  BetsAndBrains
//
//  Created by Augustine, Eric M (augus011) on 4/6/12.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import "BetsAndBrainsViewController.h"
#import "AnswerViewController.h"
#import "FaqViewController.h"
#import "Game.h"
#import "Player.h"
#import "ComputerPlayer.h"
#import "Question.h"

@implementation BetsAndBrainsViewController

@synthesize answerView;
@synthesize lobbyView;
@synthesize faqView;

-(IBAction)startSinglePlayerGame{
	Game* game = [[Game alloc] initWithName:@"singlePlayer" andNumOfPlayers:6];
	NSString* pName= @"You";
	Player* p = [[Player alloc] initWithName:pName];
	[p joinGame:game];
	for(NSInteger i = 0; i < 5; i++){
		ComputerPlayer* comp = [[ComputerPlayer alloc] initWithName:[NSString stringWithFormat:@"Computer %d", i]];
		[comp joinGame:game];
		[comp autorelease];
	}
	Question* q = [[Question alloc] initWithText:@"What year did Alan Turing die?" andAnswer:1954 ];
	game.currentQuestion = q;
	answerView.game = game;
	[game autorelease];
	[pName autorelease];
	[p autorelease];
	[q autorelease];
	[self presentModalViewController:answerView animated: TRUE];
}

-(IBAction)startMultiPlayerGame{
	//[self presentModalViewController:lobbyView animated: TRUE];
}

-(IBAction)faq{
	FaqViewController* faq = [[FaqViewController alloc]init];
	[self presentModalViewController:faq animated: TRUE];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
    
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
		
}

/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}
*/

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/


/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
}
*/

- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
	self.answerView = nil;
	self.faqView = nil;
}


- (void)dealloc {
    [super dealloc];
	[answerView autorelease];
	[faqView autorelease];
}

@end
